package com.dslcode.cloud.provider.member.service;

import com.dslcode.cloud.common.model.member.Member;
import com.dslcode.cloud.provider.member.mapper.MemberMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by dongsilin on 2017/9/21.
 */
@Slf4j
@Service
public class MemberService {

    @Autowired
    private MemberMapper memberMapper;

    public List<Member> findAll(){
        return memberMapper.findAll();
    }

    public Member findById(Long id) {
        return memberMapper.findById(id);
    }

    public Integer addPoints(Long id, int points) {
        Member member = new Member();
        member.setId(id);
        member.setPoints(points);
        return memberMapper.addPoints(member);
    }

}
